I'd like to do something like this:
var = '123'
%s = [], %var
So that, in the end, var is '123' and an empty list is named '123' as
well. The list assignments are created during a loop.
Thanks,
Brad 6 1967
On Aug 13, 1:00 pm, brad <byte8b...@gmai l.comwrote:
I'd like to do something like this:
var = '123'
%s = [], %var
So that, in the end, var is '123' and an empty list is named '123' as
well. The list assignments are created during a loop.
Thanks,
Brad
You probably want to use a dictionary to store your lists... code
like:
variableDict = {}
variableDict[var] = ['value1', 'value2', 'value3']
On 8/13/07, brad <by*******@gmai l.comwrote:
I'd like to do something like this:
var = '123'
%s = [], %var
So that, in the end, var is '123' and an empty list is named '123' as
well. The list assignments are created during a loop.
You can't assign a variable whose name is 123, but you can do this
sort of thing with setattr.
--
Evan Klitzke <ev**@yelp.co m>
Evan Klitzke wrote:
On 8/13/07, brad <by*******@gmai l.comwrote:
>I'd like to do something like this:
var = '123' %s = [], %var
So that, in the end, var is '123' and an empty list is named '123' as well. The list assignments are created during a loop.
You can't assign a variable whose name is 123, but you can do this
sort of thing with setattr.
And why would you want a variable whose name is '123'?
regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC/Ltd http://www.holdenweb.com
Skype: holdenweb http://del.icio.us/steve.holden
--------------- Asciimercial ------------------
Get on the web: Blog, lens and tag the Internet
Many services currently offer free registration
----------- Thank You for Reading -------------
On Aug 14, 12:45 am, Steve Holden <st...@holdenwe b.comwrote:
Evan Klitzke wrote:
On 8/13/07, brad <byte8b...@gmai l.comwrote:
I'd like to do something like this:
var = '123'
%s = [], %var
And why would you want a variable whose name is '123'?
.... and thus continues the search for private variables in Python.
Ali a écrit :
On Aug 14, 12:45 am, Steve Holden <st...@holdenwe b.comwrote:
>Evan Klitzke wrote:
>>On 8/13/07, brad <byte8b...@gmai l.comwrote: I'd like to do something like this: var = '123' %s = [], %var
>And why would you want a variable whose name is '123'?
... and thus continues the search for private variables in Python.
I must be tired, but I don't see what this has to do with "private"
variables.
But if you want private variables, it's quite easy: prefix their names
with a single underscore.
Steve Holden wrote:
Evan Klitzke wrote:
>On 8/13/07, brad <by*******@gmai l.comwrote:
>>I'd like to do something like this:
var = '123' %s = [], %var
So that, in the end, var is '123' and an empty list is named '123' as well. The list assignments are created during a loop.
You can't assign a variable whose name is 123, but you can do this sort of thing with setattr.
And why would you want a variable whose name is '123'?
Just an example. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: bofh |
last post by:
I'm working on a project where I need to store a CGI query in a
database field. The query contains variables which will be substitued
at runtime (e.g., today's date, key to select upon, etc), and may be
pointed to different URLs depending upon the table key.
The variable substitution works fine when hardcoding into the script,
e.g.:
$var1='data1';
|
by: Jacob Grydholt Jensen |
last post by:
I am trying to learn iSQL*Plus for the 1Z0-007 exam. I am having a bit of
problems with the substitution variables. My understanding was that they
behave as in SQL*Plus, but my experiments beg to differ.
I log on to the sample schema 'hr' and enter the following statements:
-- statements begin
set verify on
define name = K%
|
by: bmgz |
last post by:
sorry for the stupid question, bu6 I haven't been able to find the
answer anywhere..
consider this useless function which assigns an object to a var..
function(myParam){
var select1 = document.myForm.mySelectName;
}
I simply want this line to subsitute "mySelectName" with a var string
|
by: bearophileHUGS |
last post by:
The current version of ShedSkin (http://shedskin.sourceforge.net/
experimental Python to C++ compiler) is rather alpha, and the
development work is focused on debugging and implementing some more
basic Python functionality. But hopefully in future versions more work
will be spent to make the resulting C++ programs as fast as possible.
One of the many possible details that may be improved, is the compiling
to C++ of the Python "parallel"...
|
by: Graham |
last post by:
This has to do with class variables and instances variables.
Given the following:
<code>
class _class:
var = 0
#rest of the class
| |
by: KERLOG |
last post by:
Hello,
I found that in "glibc" there is a function to perform variable
substitution.
It start with $.
By digging inside the code of "glibc" I can't find how it's done.
Has someone already written such function ?
For an old BC3.1 it will be fine.
|
by: Steve Richter |
last post by:
I have a public variable ( "mZipServiceUrl" ) in my code behind class
that I am able to substitute into the HTML of the .aspx file:
<span onclick="WindowOpen('<%=mZipServiceUrl%>')"
style="text-decoration:underline;cursor:hand;color:red;">
<%=mZipServiceUrl%>
</span>
but in the same page, I cant substitute the same variable into a user
control:
|
by: Brian Newman |
last post by:
I have a form with five rows of text boxes, displaying data. For
certain reasons, I can't bind these directly to data records, so I'm
using code to load the data into an object, then manually get each
field value and assign it to each text box.
The text boxes are named like this:
txtSPctTrees1 txtSPctShrubs1 txt(etc)1 ...
txtSPctTrees2 txtSPctShrubs2 txt(etc)2 ...
txtSPctTrees3 ...
....
|
by: Skip |
last post by:
OK, I'm a novice in JS but have lots of coding experience. I am
trying to accomplish something that would seem somewhat simple - BUT
IT'S NOT.
I have a basic window that calls another window with window.open and
passes in 1 value using a querystring i.e.,
www.myhome.com/mypage?video=BAK-Extension
Now when the window opens, I can capture the passed value in a JS
function. But if I want to use that in the body of the HTML in a
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |