Skip to content
This repository was archived by the owner on Aug 11, 2023. It is now read-only.

Commit ee811c3

Browse files
committed
Update
1 parent 6dbea58 commit ee811c3

File tree

4 files changed

+22
-0
lines changed

4 files changed

+22
-0
lines changed

lessons/python/examples/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,4 @@
5858

5959
![](/lessons/python/examples/apps/color/console-color.png?style=center)
6060
- Simple [GET, POST](/lessons/python/examples/sample/get_post_service/simple-get-post-service.py) service and also [Request1](/lessons/python/examples/sample/get_post_service/simple-get-post-request.py), [Request2](/lessons/python/examples/sample/get_post_service/simple-get-post-request2.py)
61+
- Loading from [CSV](/lessons/python/examples/sample/csv_example/README.md)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Python
2+
## Working with CSV
3+
4+
- [Python code](loader.py)
5+
- [CSV](source.csv)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import sys
2+
import os
3+
import csv
4+
5+
dictionary = {}
6+
7+
with open(sys.path[0]+'/source.csv', 'r') as f:
8+
reader = csv.reader(f, delimiter=' ')
9+
for row in reader:
10+
word, meaning = row[0].split(",")
11+
dictionary[word] = meaning
12+
13+
print(dictionary)
14+
print(dictionary["hi"])
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
hi,سلام
2+
bye,خداحافظ

0 commit comments

Comments
 (0)