Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.
added 728 characters in body; added 123 characters in body
Source Link
alex
  • 169
  • 1
  • 3
  • 7

i want to know how to assign the output of print to a variable.

so if

mystring = "a=\'12\'" 

then

print mystring a=12 

and i want to pass this like **kwargs,

test(mystring) 

how can i do this?

for more of an explanation: i have a list of strings i got from a a comment line of a data file. it looks like this:

"a='0.015in' lPrime='0.292' offX='45um' offY='75um' sPrime='0.393' twistLength='0'", "a='0.015in' lPrime='0.292' offX='60um' offY='75um' sPrime='0.393' twistLength='0'", "a='0.015in' lPrime='0.292' offX='75um' offY='75um' sPrime='0.393' twistLength='0'", ''] 

i want to put the values into some structure so i can plot the various things versus any variabls so the list is a legend basically, and i want to plot functions of the traces versus variables given in teh legend.

so if for each entry i have a trace, then i may want to plot max(trace) vs offX for a series of a values.

and my first idea was to pass the strings as **kwargs to a function which would produce a matrix of corresponding data.

i want to know how to assign the output of print to a variable.

so if

mystring = "a=\'12\'" 

then

print mystring a=12 

and i want to pass this like **kwargs,

test(mystring) 

how can i do this?

i want to know how to assign the output of print to a variable.

so if

mystring = "a=\'12\'" 

then

print mystring a=12 

and i want to pass this like **kwargs,

test(mystring) 

how can i do this?

for more of an explanation: i have a list of strings i got from a a comment line of a data file. it looks like this:

"a='0.015in' lPrime='0.292' offX='45um' offY='75um' sPrime='0.393' twistLength='0'", "a='0.015in' lPrime='0.292' offX='60um' offY='75um' sPrime='0.393' twistLength='0'", "a='0.015in' lPrime='0.292' offX='75um' offY='75um' sPrime='0.393' twistLength='0'", ''] 

i want to put the values into some structure so i can plot the various things versus any variabls so the list is a legend basically, and i want to plot functions of the traces versus variables given in teh legend.

so if for each entry i have a trace, then i may want to plot max(trace) vs offX for a series of a values.

and my first idea was to pass the strings as **kwargs to a function which would produce a matrix of corresponding data.

Source Link
alex
  • 169
  • 1
  • 3
  • 7

assign output of print to a variable in python

i want to know how to assign the output of print to a variable.

so if

mystring = "a=\'12\'" 

then

print mystring a=12 

and i want to pass this like **kwargs,

test(mystring) 

how can i do this?