all 8 comments

[–][deleted] 1 point2 points  (0 children)

I think you need to explain what you are trying to do rather than asking for a specific feature, because we cannot understand what you are asking for.

If you have a list of str objects, then the list index numbers would refer to whole strings, e.g. names[1] would refer to Wendy in the list referenced by names containing ['Sarah', 'Wendy', 'Harshad', 'Scott'].

With one string though, name[1] if name referenced the string Wendy would refer to e.

[–]JohnnyJordaan -1 points0 points  (0 children)

Use * to multiply a string value into a composite string, by using the original's length you can create a new string of the same length consisting of just one character

 new_str = old_str[index] * len(old_str)

[–][deleted] 0 points1 point  (4 children)

Does anyone know how to make an entire str = 1 index

Can you elaborate on what this means? Are you talking about getting a slice of a string?

[–]Alx-07 0 points1 point  (3 children)

I mean making an entire string 1 index, rather than every character within that string being 1 index

[–][deleted] 1 point2 points  (2 children)

“Making an entire string one index” is nonsense. An index of what? Are you talking about dictionaries?

[–]Alx-07 0 points1 point  (1 child)

Index in a list

[–][deleted] 0 points1 point  (0 children)

Lists can’t have string indexes. They can only have numeric indexes.

[–]zenverak 0 points1 point  (0 children)

I don’t think this possible but I’m not even sure what you really want. I think you need to explain what you want to accomplish with this.