exec('a = 5')
print a
Když to spustím:>>> 5 >>> a 5 >>> a + 2 7 >>> To je to přesné řešení ! Díky V.L. Lansky, Milan napsal(a):
exec(p1 + '=' + str(h1)) -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of "Ing. Vladislav Ludík" Sent: Tuesday, December 21, 2010 12:45 AM To: Konference PyCZ Subject: [python] vytvoření proměnných Zdravím všechny,poradí někdo účinnou a jednoduchou metodu vytvoření spojení názvů proměnných s jejich hodnotami:x => {p1, p2, p3, ...pn} y => {h1, h2, h3, ...hn} kde p jsou proměnné a h jsou jejich hodnoty. Výsledkem by měly být deklarované proměnné s jejich hodnotami: p1 = h1 p2 = h2 p2 = h3 . . pn = hn Díky, zdraví V.L. _______________________________________________ Python mailing list [email protected] http://www.py.cz/mailman/listinfo/python This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you. _______________________________________________ Python mailing list [email protected] http://www.py.cz/mailman/listinfo/python __________ Informace od NOD32 5721 (20101221) __________ Tato zprava byla proverena antivirovym systemem NOD32. http://www.nod32.cz
_______________________________________________ Python mailing list [email protected] http://www.py.cz/mailman/listinfo/python
