Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Code Block
languagepy
themeEmacs
titleread
import requests
import csv

Url = 'http://xxxx/aaaa.txt'
SaveFileName = 'data/aaa.txt'

def downLoadTourH(saveFile):
    r = requests.get(url, allow_redirects=True)
    open(saveFile, 'wb').write(r.content)

def loadCsvFromTourH():

    with open(TourGoodsFileName, newline='\n',encoding='utf-8') as csvfile:
        reader = csv.DictReader(csvfile,dialect='excel-tab')
		#reader = csv.DictReader(csvfile, delimiter='\t')
        for row in reader:
            print(row['id'], row['region1'])


downLoadTourH(SaveFileName)


loadCsvFromTourH()
         

...