参数化方法

##txt参数化
# -*- coding: utf-8 -*-
phnumfile=file('D:\\1.txt','r')
phnum=phnumfile.read()
for i in phnum:
    print i


##字典参数化:
def zidian():
    data={'suser@umser':'1','cuser@unimart':'1'}
##    print ("success reader username and password!!")
    return data


info =zidian()

for us,pw in info.items():
    print us
    print pw

 

##cvs文件读取

#coding=utf-8
import csv #导入csv 包
#读取本地CSV 文件
my_file='D:\\selenium_python\\data\\userinfo.csv'
data=csv.reader(file(my_file,'rb'))
#循环输出每一行信息
for user in data:
print user[0]
print user[1]
print user[2]
print user[3]

 

posted @ 2017-03-22 14:21  cc344525813  阅读(322)  评论(0编辑  收藏  举报