java3D.rar.html - How to become a keygen of your own. com is 100% safe. All our products are sent by the High Quality and Secure RAR archive.Q:
How to separate a list of links in python
I have a list of links in python:
['url1', 'url2', 'url3',...]
I need to separate each one of them and save each separated url in a different list.
I want to do that in python. How can I do that?
A:
Just use a list comprehension.
e.g.
my_list = ['url1', 'url2', 'url3',...]
new_list = [x for x in my_list if x!= 'url1']
This will create a new list from an existing list of strings which are not 'url1'.
The following line will print the new list
print(new_list)
it prints
[url2, url3,...]
Use split on each element in the list:
urls = ['url1', 'url2', 'url3']
links = []
for url in urls:
links.append(url.split(':')[1])
/*
* Copyright © 2014 Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
Related links: