Latest web development tutorials

Python include esercizi 98

Python 100 Li Python 100 Li

Titolo: input da tastiera da una stringa, tutte le lettere minuscole a maiuscole, e poi l'uscita di un file su disco "test" per salvare.

Analisi del programma: Nessuno.

Source Code:

#!/usr/bin/python
# -*- coding: UTF-8 -*-

if __name__ == '__main__':
    fp = open('test.txt','w')
    string = raw_input('please input a string:\n')
    string = string.upper()
    fp.write(string)
    fp = open('test.txt','r')
    print fp.read()
    fp.close()

L'output sopra esempio è:

please input a string:
w3big.com
w3big.com

Python 100 Li Python 100 Li