On 10/6/06, Gerrit Holl <[EMAIL PROTECTED]> wrote:
> >>> import fnmatch
> >>> var1, var2, var3 = "foo", "bar", "baz"
> >>> for k in fnmatch.filter(locals(), "var*"):
> ... print locals()[k]
> ...
> foo
> baz
> bar
>
> This is evil.
> It's unpythonic.
It's so evil, Perl 4 would look upon it in sc
On 2006-10-06 04:50:33 +0200, [EMAIL PROTECTED] wrote:
> say i have variables like these
>
> var1 = "blah"
> var2 = "blahblah"
> var3 = "blahblahblah"
> var4 = ""
> var5 = "..."..
>
> bcos all the variable names start with "var", is there a way to
> conveniently print those variables out...
>
[EMAIL PROTECTED] wrote:
> Thanks all for the answers. Yup, i think i will use dicts/tuples/lists
> instead...
Even though you should be using some kind of container, you can still
do what you origianlly asked for with relative ease...you just have to
use the evil eval function (gasp!):
for i in
Fredrik Lundh wrote:
> [EMAIL PROTECTED] wrote:
>
> > say i have variables like these
> >
> > var1 = "blah"
> > var2 = "blahblah"
> > var3 = "blahblahblah"
> > var4 = ""
> > var5 = "..."..
> >
> > bcos all the variable names start with "var", is there a way to
> > conveniently print
On Oct 5, 9:47 pm, [EMAIL PROTECTED] wrote:
> hi
> say i have variables like these
>
> var1 = "blah"
> var2 = "blahblah"
> var3 = "blahblahblah"
> var4 = ""
> var5 = "..."..
>
> bcos all the variable names start with "var", is there a way to
> conveniently print those variables out...
> eg prin
[EMAIL PROTECTED] wrote:
> hi
> say i have variables like these
>
> var1 = "blah"
> var2 = "blahblah"
> var3 = "blahblahblah"
> var4 = ""
> var5 = "..."..
>
> bcos all the variable names start with "var", is there a way to
> conveniently print those variables out...
> eg print var* ??
> i don't
[EMAIL PROTECTED] wrote:
> say i have variables like these
>
> var1 = "blah"
> var2 = "blahblah"
> var3 = "blahblahblah"
> var4 = ""
> var5 = "..."..
>
> bcos all the variable names start with "var", is there a way to
> conveniently print those variables out...
do you often (or alwa
[EMAIL PROTECTED] wrote:
> hi
> say i have variables like these
>
> var1 = "blah"
> var2 = "blahblah"
> var3 = "blahblahblah"
> var4 = ""
> var5 = "..."..
>
> bcos all the variable names start with "var", is there a way to
> conveniently print those variables out...
> eg print var* ??
> i don'
[EMAIL PROTECTED] wrote:
> say i have variables like these
>
> var1 = "blah"
> var2 = "blahblah"
> var3 = "blahblahblah"
> var4 = ""
> var5 = "..."..
>
> bcos all the variable names start with "var", is there a way to
> conveniently print those variables out...
do you often (or always) trea
hi
say i have variables like these
var1 = "blah"
var2 = "blahblah"
var3 = "blahblahblah"
var4 = ""
var5 = "..."..
bcos all the variable names start with "var", is there a way to
conveniently print those variables out...
eg print var* ??
i don't want to do :
print var1, var2, var3, var4 .
10 matches
Mail list logo