python python片段

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python python片段相关的知识,希望对你有一定的参考价值。

#
for untilListConsumed:
  do something

while untilConditionTrue:
  do something
 
# 
msg = "a %s %s" % (name, surname)

#
a = ['a','b','c']
b = [1,2,3]
for i,j in zip (a,b):
    print("%s is %s" %(i,j))

a is 1
b is 2
c is 3

#
try:
except:
  
# with handles close()
with open("example.txt","w") as myfile:
...     myfile.write("something")

#pandas open csv
import pandas
df = pandas.read_csv("C:\Users\jwang31\Documents\py\crime.csv")
df

以上是关于python python片段的主要内容,如果未能解决你的问题,请参考以下文章

python Python片段

python 有用的Python代码片段

python Python测试片段

python Python片段

python Python - 有用的片段

python 有用的python片段