Python Forum
Convert a string to a function
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Convert a string to a function
#3
Self modifying code, execution of user supplied code, all generally frowned upon as unsafe. Still, people ride barrels over Niagara Falls (not lately).

You are probably looking for the exec() function.
See this article for instruction and usage.
ndc85430 likes this post
Reply


Messages In This Thread
Convert a string to a function - by mikepy - May-13-2022, 05:30 PM
RE: Convert a string to a function - by ndc85430 - May-13-2022, 05:36 PM
RE: Convert a string to a function - by jefsummers - May-13-2022, 05:52 PM
RE: Convert a string to a function - by mikepy - May-13-2022, 06:08 PM
RE: Convert a string to a function - by ndc85430 - May-13-2022, 06:54 PM
RE: Convert a string to a function - by mikepy - May-13-2022, 06:05 PM
RE: Convert a string to a function - by deanhystad - May-13-2022, 06:27 PM
RE: Convert a string to a function - by deanhystad - May-13-2022, 07:11 PM
RE: Convert a string to a function - by mikepy - May-13-2022, 07:28 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  convert string to float in list jacklee26 6 2,016 Feb-13-2023, 01:14 AM
Last Post: jacklee26
  how to convert tuple value into string mg24 2 2,459 Oct-06-2022, 08:13 AM
Last Post: DeaD_EyE
  Convert string to float problem vasik006 8 3,517 Jun-03-2022, 06:41 PM
Last Post: deanhystad
Question How to convert string to variable? chatguy 5 2,570 Apr-12-2022, 08:31 PM
Last Post: buran
  Convert string to int Frankduc 8 2,579 Feb-13-2022, 04:50 PM
Last Post: menator01
  Convert string to path using Python 2.7 tester_V 10 6,613 Nov-20-2021, 02:20 PM
Last Post: snippsat
  Convert each element of a list to a string for processing tester_V 6 5,464 Jun-16-2021, 02:11 AM
Last Post: tester_V
Question convert unlabeled list of tuples to json (string) masterAndreas 4 7,564 Apr-27-2021, 10:35 AM
Last Post: masterAndreas
  Convert String of an int array to a Numpy array of ints mdsousa 5 5,787 Apr-08-2021, 08:00 PM
Last Post: mdsousa
  Convert string to JSON using a for loop PG_Breizh 3 3,021 Jan-08-2021, 06:10 PM
Last Post: PG_Breizh

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020