tuples Questions

2

I have a piece of Python code: def func1(): a=set() b = ','.join(map(str, list(a))) return b, [] def func2(): d = 1 e = 2 return func1() + (d, e,) def main(): a,b,c,d = func2() if __name...
Embolism asked 16/1, 2015 at 8:46

7

Solved

How do I reverse the types in a tuple? For example, I want reverse_tuple<std::tuple<int, char, bool>>::type to be std::tuple<bool, char, int>. I tried doing the following but it d...
Namedropping asked 18/6, 2013 at 20:15

12

Solved

I'm wondering if I can somehow use an x, y pair as the key to my dictionary let activeSquares = Dictionary <(x: Int, y: Int), SKShapeNode>() But I get the error: Cannot convert the expres...
Kimberleykimberli asked 10/6, 2014 at 0:59

9

Solved

Does python have immutable lists? Suppose I wish to have the functionality of an ordered collection of elements, but which I want to guarantee will not change, how can this be implemented? Lists a...
Suomi asked 21/6, 2012 at 16:15

10

Solved

How would I be able to take a string like 'aaaaaaaaaaaaaaaaaaaaaaa' and split it into 4 length tuples like (aaaa,aaaa,aaaa)
Roast asked 25/1, 2014 at 13:39

5

Solved

I tried to find the available methods but couldn't find it. There is no contains. Should I use index? I just want to know if the item exists, don't need the index of it.
Perionychium asked 29/7, 2013 at 9:16

2

Solved

>>> a=1 >>> b=1 >>> id(a) 140472563599848 >>> id(b) 140472563599848 >>> x=() >>> y=() >>> id(x) 4298207312 >>> id(y) 42...
Vtol asked 13/12, 2014 at 14:6

5

Solved

How do I convert this dataframe location value 0 (Richmond, Virginia, nan, USA) 100 1 (New York City, New York, nan, USA) 200 to this: city state region country value 0 Richmond Virgini...
Brade asked 28/8, 2014 at 22:49

9

Solved

C# 7.0 introduced value tuples and also some language level support for them. They added the support of single and zero element tuples as well; however, I could not find out any scenario when they ...
Colmar asked 7/8, 2018 at 9:8

4

Solved

not sure if this is possible, but I would like to be able to define a type that converts tuples like: [number, string, undefined, number] to [number, string, number] (ie filter out undefined). I t...
Northing asked 9/2, 2019 at 14:55

11

I'm working on a script where I have a list of tuples like ('1','2','3','4'). e.g.: list = [('1','2','3','4'), ('2','3','4','5'), ('3','4','5','6'), ('4','5','6','7')] Now I need to add '1234...
Moccasin asked 6/2, 2011 at 12:50

1

Solved

Background: I'm trying to port a library to compile on MSVC. That library stores data in a tuple of vectors (std::tuple<std::vector<Ts>...>), and uses a custom iterator to iterate over ...
Maples asked 17/8, 2023 at 13:24

5

Solved

Currently I'm doing this: def getJSONString(lst): join = "" rs = "{" for i in lst: rs += join + '"' + str(i[0]) + '":"' + str(i[1]) + '"' join = "," return rs + "}" which I call like: rs ...
Bronk asked 7/12, 2012 at 10:16

3

Solved

I have a list in C# called MyList: List<Tuple<string, int, int>> MyList= new List<Tuple<string, int, int>>() { Tuple.Create("Cars", 22, 3), Tuple.Create("Cars", 28, 5),...
Photophilous asked 6/3, 2020 at 11:26

9

Solved

I am creating a database connection. While trying to add to the DB, I am thinking of creating tuples out of information and then add them to the DB. I am taking information from the user and store ...
Woolfolk asked 4/9, 2009 at 18:36

2

Solved

A list can be created n times: a = [['x', 'y']]*3 # Output = [['x', 'y'], ['x', 'y'], ['x', 'y']] But I want to make a tuple in such a way but it not returning the similar result as in the list....
Fission asked 12/11, 2016 at 23:16

7

Solved

I have the following element of a list, and the list is 100 elements long. [(50, (2.7387451803816479e-13, 219))] How do I convert each element to look like this? [(50, 2.7387451803816479e-13, ...
Brasilin asked 29/8, 2013 at 0:36

4

Solved

If I want to unpack a tuple and pass it as arguments is there a way to do this: //Does not compile fn main() { let tuple = (10, Vec::new()); foo(tuple); } fn foo(a: i32, b: Vec<i32>) { //...
Barroom asked 5/10, 2016 at 15:41

3

Solved

My general understanding is that a tuple is a row. However, I'm using the Postgres dev plan in Heroku. It has a limit of 10,000 rows. I have over 100,000 entries for n_live_tup. How can this be?
Hardiman asked 5/11, 2013 at 21:24

15

Solved

Is there anyway to get tuple operations in Python to work like this: >>> a = (1,2,3) >>> b = (3,2,1) >>> a + b (4,4,4) instead of: >>> a = (1,2,3) >>&g...
Conquest asked 31/1, 2009 at 0:51

2

t = (1,2,3) t1 = (1,2,3) print(id(t)) print(id(t1)) The above lines of code gives the same addresses in script mode in Python, but in interactive mode it outputs different addresses. Can anyone e...
Ecker asked 11/6, 2020 at 15:20

7

Solved

I would like do something like that. list_of_urls = ['http://www.google.fr/', 'http://www.google.fr/', 'http://www.google.cn/', 'http://www.google.com/', 'http://www.google.fr/', 'http://www.g...
Stonecutter asked 7/11, 2009 at 8:7

10

Solved

I am trying to pull data from a database and assign them to different lists. This specific error is giving me a lot of trouble "TypeError: tuple indices must be integers, not str" I tried...
Shrubbery asked 12/2, 2016 at 10:16

8

Sorry in advance, but I'm new to Python. I have a list of tuples, and I was wondering how I can reference, say, the first element of each tuple within the list. I would think it's something like ...
Bergstrom asked 23/6, 2011 at 13:32

7

Solved

I'm working with C# and .NET Framework 4.5.1 retrieving data from a SQL Server database with Entity Framework 6.1.3. I have this: codes = codesRepo.SearchFor(predicate) .Select(c => new Tuple...
Hydrocarbon asked 5/11, 2015 at 13:1

© 2022 - 2024 — McMap. All rights reserved.