File Output,fileoutput,log_file = o
File Output,fileoutput,log_file = o
log_file = open('c:\\debuglog.log', 'w')log_file.write('Starting program')done = Falsewhile not done: s = raw_input('Enter a string to reverse (exit to quit): ') if s == 'exit': break; log_file.write('The user entered: '+s) # Reverse the string sr = '' for c in s : sr = c + sr log_file.write('The reversed string is: '+sr+'\n') print 'The reversed string is: ' + srlog_file.write('Ending program');log_file.close()
- str Function,strfunction,# The str fu
- Use seek() to move file pointer,seekpointer,f = open('
- Define class to deal with files,definedeal,class FileS
- A tuple with one item: a comma,tuplecomma,# A tuple wi
- File read() Demo,filereaddemo,f = open(r'c
- File writelines(list),filewritelines,f = open(r'c
热门文章:
相关内容
- str Function,strfunction,# The str fu
- Use seek() to move file pointer,seekpointer,f = open('/t
- Define class to deal with files,definedeal,class FileSt
- A tuple with one item: a comma,tuplecomma,# A tuple wi
- File read() Demo,filereaddemo,f = open(r'c
- File writelines(list),filewritelines,f = open(r'c
- Using Lists as Stacks,listsstacks,#To add an i
- if-else structure,if-else,print 'passw
- Extracting the Ingredients from a Recipe with Regular Expressions,,
- for statement calls iter() on the container object,itercontainer,fo
评论关闭