|
Server IP : 10.128.40.6 / Your IP : 216.73.217.20 Web Server : Apache System : Linux webd006.cluster128.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64 User : logmcpe ( 111175) PHP Version : 7.3.33 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0755) : /home/logmcpe/www/TMCPRO/test/../pages/python/ |
| [ Home ] | [ C0mmand ] | [ Upload File ] |
|---|
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 20 22:52:33 2022
@author: pro
"""
liste1 = [i for i in range(20)]
print(liste1)
liste2 = [i**2 for i in range(20)]
print(liste2)
dictionnaire = {
i:n for i,n in zip(liste1,liste2)
}
print(dictionnaire)
print('----------------------------------------------------')
dic = { k:v for k,v in zip([i for i in range(10)] ,[j**2 for j in range(10)])}
# dic = { k:v for k,v in zip([i for i in range(10)],[j**2 for j in range(10)]) }
print(dic)
print('----------------------------------------------------------')
dic3 = {
'i':i**2 for i in range(20)
}
# with open("test.txt", encoding = 'utf-8') as f:
# lis1 = [f.read()]
f =open("file1.txt","w")
for i in range(10):
f.write('le carre de {} est {} ,'.format(i, i**2))
# f.write("apple, microsoft, amazon, alphabet, facebook")
f = open('file1.txt', 'r')
chaine = f.read()
lis1 = chaine.split(",")
print('test')
f.close()
print("the list is ",lis1)
txt_file =open("apple.txt","w")
txt_file.write("apple, microsoft, amazon, alphabet, facebook")
txt_file = open("apple.txt", "r")
file_content = txt_file.read()
print("The file content are: ", file_content)
content_list = file_content.split(",")
txt_file.close()
print("The list is: ", content_list)
