Home Python: one variable but different values?
Reply: 1

Python: one variable but different values?

Shoaib Khan
1#
Shoaib Khan Published in 2018-01-11 18:14:49Z

This question already has an answer here:

  • Why does adding a trailing comma after a variable name make it a tuple? 6 answers
  • Can someone explain __all__ in Python? 8 answers

I have a line of code from Python forbidden fruit module:

__all__ = 'curse', 'curses', 'reverse'

I know what strings are and I know what arrays and tuples are. What kind of variable is this? How can we use this and for what?

Finlay McWalter
2#
Finlay McWalter Reply to 2018-01-11 18:16:35Z

It's a tuple. If you want to find out the type of something, use the type function - e.g.

type(__all__)
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.328423 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO