All Questions
940 questions
0
votes
3
answers
78
views
Python split() function :: Need to split "int_32\n' " so that I get int_32 alone [duplicate]
Need to split "int_32\n' " so that I get int_32 alone.
I tried
x = "int_32\n' "
x.split("\n")
I also tried
x = "int_32\n' "
x.splitlines()
Both do not yield ...
0
votes
2
answers
81
views
How can I replace every instance of a character from 3 groups of characters with just 3 different characters respectively?
This is my input:
"Once there was a (so-called) rock. it.,was not! in fact, a big rock."
I need it to output an array that looks like this
["Once", " ", "there&...
0
votes
0
answers
35
views
Reconstructing Original String from Partial Strings with Missing Letters
I have a string of length n, let's say "ABCDEFG". The string can have duplicate characters, so "ABCBCAGFH" is also a valid string.
I also have a list of strings that are made from ...
0
votes
2
answers
77
views
Difference between passing in string vs. array parameters to recursive function
This may be a dumb question so I am sorry, but there is a Leetcode problem where you have to return all of the paths from the root node to leaf nodes in an array of strings connected with "->&...
-1
votes
2
answers
107
views
Why does this not print hello at the end but instead the letters are all scrambled
Im tying to create a effect that make the string "hello" gradually appear:
import time
text = "hello"
alphebet = [
"a", "b", "c", "d", &...
0
votes
2
answers
105
views
Python converting string to array [duplicate]
I'm recently tring to make a python code to convert a string to array.
For example:
'[[M,,[10,20]],[F,,[7,9]]]' to [['M','',['10','20']],['F','',['7','9']]]
The reason I need it is that I am importing ...
0
votes
1
answer
274
views
Codewars 4 kyu "Most frequently used words in a text" with Python
Write a function that, given a string of text (possibly with punctuation and line-breaks), returns an array of the top-3 most occurring words, in descending order of the number of occurrences.
...
0
votes
1
answer
53
views
How to update an already existing array by accessing it by a variable with the exact same name assigned to it
i declared an array earlier on in the program and then assigned a variable to the exact same array name .
I later on attempted to change a value within the array using the variable name i declared but ...
0
votes
3
answers
77
views
How to convert a split string into floats but ignore objects in Python?
I have a text file 'lines.txt' as shown:
0.02 7 433 649 239 32
0.04 84 43 594 2 321
0.06 65 34 94 5 138
0.08 43 56 23 10 432
1.00 2 382 37 29 102
1.20 573 475 82 757 29
Time (s)
Number (unit)
Third (...
-2
votes
1
answer
69
views
Converting array of Integers to String in Python
Can someone please help me with below request.
I am trying to convert the below output from sql in Python and use as string
Value=[(132,), (2434,), (233434,), (56644,), (3435,), ]
Output:
Value=132,...
1
vote
2
answers
69
views
str giving only one element as output but object fix the problem
I have to write a python code, there are a function and it receive a tuple as parameter where all the elements of tuple are numpy array. The output of that code will give me unique hobbies from this ...
2
votes
2
answers
159
views
Cutting string near space positions
I have an array of space positions for a given string like this:
[3, 7, 11, 18, 24, 29, 34, 45, 50, 55, 59, 67, 70, 75, 80, 84, 90, 93, 97, 108],
and I have an array of values which are the borders of ...
0
votes
0
answers
58
views
Ctypes 2d array of strings in python stores different strings at same memory address
the python code i have is pretty simple:
from ctypes import *
from random import randint
class uni(Union):
_fields_ = [('p', c_char_p),
('a', c_longlong)]
#initializing the array ...
0
votes
1
answer
25
views
getting specified format input from Entry widget in python
I want to convert a string in specified format (start-stop-dataNumber) to a array.
datanumber is a number of data in that range from start to stop.
for example:
input="1-10:5"
output=[1,3,5,...
0
votes
2
answers
447
views
I am trying to find a way to act on characters in an array in Python
I am very new to coding and Python. I am trying to change characters in string elements of an array conditional on their adjacency to another character.
These characters are grouped into arrays based ...