Query about Split() function in python [closed] - python

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 3 years ago.
Improve this question
So here is the thing, I have a variable with the list data
[('https://jira.corp.***.com/browse/DE-3872',), ('https://jira.corp.***.com/browse/DE-3839',)].
I'm basically using split() to get the last ID ( DE-3872.. etc)
If I do this ,
for link in data:
issue = data[0][0].split('/')[4]
print(issue)
This is the output I'm getting
DE-3872
DE-3872
It prints the first value twice, but what I'm trying to get is ,
DE-3872
DE-3839

You are printing the same thing twice, use:
for link in data:
issue = link[0].split('/')[-1]
print(issue)
The [-1] index will return the last part of the result.

Related

How do I print only the letters of a list in uppercase? [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 5 months ago.
Improve this question
New to python and working on lists. The items in my lists consists of letters and numbers, and I'm wondering how to print the letters in uppercase. This is what I have.
dirtbike = ['yz450', 'kx450', 'rmz450', 'ktm450', 'fc450']
message = f"I would love to own a {dirtbike[0]}! As well as a {dirtbike[1]}!"
print(message)
I would like the print out to be 'YZ450' & 'KX450' but have only managed to print the whole message in upper using message.upper
You can use the method upper inside the brackets.
message = f"I would love to own a {dirtbike[0].upper()}! As well as a {dirtbike[1].upper()}!"

How to give the variables to python function which has default value [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 1 year ago.
Improve this question
When giving the function like this
Every parameters have default value.
def reverb(self,
reverberance=50,
hf_damping=50,
room_scale=100,
stereo_depth=100,
pre_delay=20,
wet_gain=0,
wet_only=False):
I want to set only reverberance parameter ,but it doesn't work
reverb("reverberance"=5)
How can I set specific value??
Quick and easy fix:
reverb(reverberance=5)
Because it's a variable, not a string, it doesn't need quotation marks.

Python - if SystaxError [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 5 years ago.
Improve this question
I have problem with this if.
I found I can use in in if-statement.
if "log" in sys.argv[1:]
Syntax Error
If you don't show us the code surrounding the if-statement, we cannot know for sure what the problem is. If I were to make a guess however, I'd say you're missing a colon:
if "log" in sys.argv[1:]:
See the documentation for compound statements (like ifs):
Each clause header begins with a uniquely identifying keyword and ends with a colon

Getting data from Google Maps python object [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 6 years ago.
Improve this question
I've gathered some data from Google Maps API but I'm stuck on getting out the LAT/LNG.
Creating object:
loc = self.google_maps.geocode(location)
I cannot traverse down this object:
pprint(loc)
I've tried:
loc.address_components
loc['address_components']
loc->address_components
loc.geometry
loc['geometry']
etc which all fail. This feels like such a simple question but I don't know they all fail to work
You should try:
loc[0]['address_components']
# ^ index the list
That's because your dict is contained in a list.
The same applies to other dictionaries that deeply nested:
loc[0]['address_components'][0]['long_name']
# or loc[0]['address_components'][1]['long_name'] for second nested dict

Why is this not outputting anything? [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 9 years ago.
Improve this question
Why isn't this giving an output? It is meant to take a sentence as an input and then output the identification of each word.
You never call the function. You do need to run the function to get the output:
print word_identify(words)

Categories