Tuples'ai

Tuple - in a database, an ordered set of data constituting a record; a data structure consisting of comma-separated values passed to a program or operating system.

Pavyzdys

tuple = 12345, 67890, "Linas", "Valiukas"
 
print tuple # (12345, 67890, 'Linas', 'Valiukas')
 
print tuple[0] # 12345
 
dar_vienas = tuple, (1, 2, 3, 4, 5)
print dar_vienas # ((12345, 67890, 'Linas', 'Valiukas'), (1, 2, 3, 4, 5))
print dar_vienas[0][2] # Linas

Tuples, like strings, are immutable: it is not possible to assign to the individual items of a tuple (you can simulate much of the same effect with slicing and concatenation, though)

Tuple'as su vienu elementu

# Tuple'as su vienu elementu
tuple = "Linas",
This website uses cookies for visitor traffic analysis. By using the website, you agree with storing the cookies on your computer.More information
 
Jei nenurodyta kitaip, šio wiki turinys ginamas tokia licencija: CC Attribution-Noncommercial-Share Alike 4.0 International
Recent changes RSS feed Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki