Latest web development tutorials

Python comprend des exercices 98

Python 100 Li Python 100 Li

Titre: l' entrée au clavier d'une chaîne, toutes les lettres minuscules en majuscules lettres, puis la sortie vers un fichier sur le disque "test" pour enregistrer.

Analyse du programme: Aucun.

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'exemple ci-dessus sortie est:

please input a string:
w3big.com
w3big.com

Python 100 Li Python 100 Li