日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > python >内容正文

python

python中next(reader)_Python错误self.reader.next()

發布時間:2023/12/18 python 32 豆豆
生活随笔 收集整理的這篇文章主要介紹了 python中next(reader)_Python错误self.reader.next() 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

當您使用with時,文件只會在您的in范圍內保持打開狀態,當for row in reader:縮進錯誤時,您的文件將關閉,我在下面測試并得到please select year of study:import csv

LOAD_GEN_DATAFILE = 'C:\\Users\\Dirty-Santa\\Desktop\\blah.csv'

with open(LOAD_GEN_DATAFILE) as csvfile:

reader = csv.DictReader(csvfile)

mydict = {}

for row in reader:

Year=row['Year']

Busnum=row['Busnum']

Area=row['Area']

Power=row['Power']

TLA=row['TLA']

Location=row['Location']

Yearlink=row['Yearlink']

From=row['From']

To=row['To']

Max=row['Max']

Min=row['Min']

year = raw_input("Please Select Year of Study: ")

print("\n")

commands = ["Millwood-Buchanan", "Astoria-East-Corona", "Bronx", "DUNWOODIE-North-Sherman_Creek",

"Vernon", "Greenwood-StatenIsland","West_49th","East_13th","Staten_Island","East_River",

"East_View","DUNWOODIE-SOUTH","Corona-Jamaica","Astoria-East-Corona-Jamaica",

"Astoria-West-Queensbridge-Vernon","Astoria-West-Queensbridge"]

max_columns = 50

for index, commands in enumerate(commands):

stars_amount = max(max_columns - len(commands), 0)

row = "# {} {}({})".format(commands, "." * stars_amount, index + 1)

print(row)

location=raw_input(" \n The list above show the TLA Pockets as well as the ID numbers assigned to them ()\n\n Please enter the ID #: ")

print("\n")

if year in Year and location in Location:

mydict=(Busnum,Area,Power)

print("Here are all the busses at that location for that year and the new LOAD TOTAL: ")

print("\n")

#Busnum, busname,scaled_power read from excel sheet matching year and location

for Busnum,Area,Power in mydict:

Power= float(scaled_power)

Busnum = int(busnum)

print('Bus #: %d\t' % Busnum ,'Area Station: %s\t'% Area,'New Load Total: %d MW\t' % Power)

#API for changing and scaling generation of loads

#psspy.bsys(1,0,[0.0,0.0],0,[],1,[Busnum],0,[],0,[])

#psspy.scal_2(1,0,1,[0,0,0,0,0],[0.0,0.0,0.0,0.0,0.0,0.0,0.0])

#psspy.scal_2(0,1,2,[0,1,0,1,0],[Power,0.0,0,-.0,0.0,-.0,0])

#print("\n")

總結

以上是生活随笔為你收集整理的python中next(reader)_Python错误self.reader.next()的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。