Sponsored Content
Top Forums Programming Python 3 remove the space after the last / Post 303039694 by bob123 on Saturday 12th of October 2019 10:03:10 AM
Old 10-12-2019
Python 3 remove the space after the last /

using python 3 when i run this code to get the urls i get a space in the url

how do i remove the space after the last /

thanks

Code:
# Import libraries
import requests
from bs4 import BeautifulSoup

# Connect to the URL
page = requests.get('https://www.meihoski.co.jp/movie/')
soup = BeautifulSoup(page.content, 'html.parser')
#get all links with href and add the missing part of the url to the front
for a in soup.find_all('a', href=True):
       print('https://www.meihoski.co.jp/movie/',a['href'])

i get a list of urls like this with a space need to remove the space after the /
Code:
https://www.meihoski.co.jp/movie/ meiho_tvcm_ma.mp4


Last edited by bob123; 10-12-2019 at 11:31 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

remove space characters

hello I have this output ifspeed 100000000 ifspeed 100000000 collisions 413 collisions 10 duplex full duplex ... (1 Reply)
Discussion started by: melanie_pfefer
1 Replies

2. Shell Programming and Scripting

to remove space after numeric

I have a script that shows me the disk SPace used by different dir under my home dir: #!/bin/ksh cd /ednpdtu3/u01/pipe p1=`df -g | tail -1 | tr -s " " | cut -d " " -f2` echo "Total Disk Space of Home Dir is $p1 GB" p2=`df -g | tail -1 | tr -s " " | cut -d " " -f3` echo "Total Disk Space... (2 Replies)
Discussion started by: ali560045
2 Replies

3. UNIX for Dummies Questions & Answers

Space in file how to remove

Hello I have a file with data something like this in it : texttexttext "text .lst" TEXT=" text " texttexttext "moretext .lst" TEXT=" text " Question is how do I get rid of space so that the files looks like this : texttexttext "text.lst" TEXT="text" texttexttext... (8 Replies)
Discussion started by: davebw
8 Replies

4. Shell Programming and Scripting

Remove space

DATE=6/Jul/2010 6/Jul/2010 var="sed -n '/\ ---------- Post updated at 11:49 AM ---------- Previous update was at 11:36 AM ---------- #!/bin/bash DATE=`./get_date.pl 3` DATE1=`./get_date.pl 2` var1=$( echo "$DATE" | sed "s/ //g" ) var2=$( echo "$DATE1" | sed "s/ //g" ) var="sed -n... (1 Reply)
Discussion started by: sandy1028
1 Replies

5. Shell Programming and Scripting

Remove last space in a string?

I have a customer file now and would like to separate the names into two cells in a spreadsheet. Here is my data as an example: SHAWN R KEEGAN shawn r scroggin Shawn Regan Shawn Reilly The first two have the middle initial so I'd like to include them in the "first name" field and the last... (11 Replies)
Discussion started by: Grassy
11 Replies

6. Shell Programming and Scripting

remove space

File A.txt A005 -119.5 -119.5 -100.5 A006 -120.5 -119.5 -119.3 A008 0 0 0 Output A005 -119.5 -119.5 -100.5 A006 -120.5 ... (1 Reply)
Discussion started by: asavaliya
1 Replies

7. Shell Programming and Scripting

Remove trailing space

Hi I am trying to remove trailing space from a string. value=${value%% } It is not working. What might be the issue with the above snippet. (7 Replies)
Discussion started by: munna_dude
7 Replies

8. UNIX for Advanced & Expert Users

Need to remove leading space from awk statement space from calculation

I created a awk state to calculate the number of success however when the query runs it has a leading zero. Any ideas on how to remove the leading zero from the calculation? Here is my query: cat myfile.log | grep | awk '{print $2,$3,$7,$11,$15,$19,$23,$27,$31,$35($19/$15*100)}' 02:00:00... (1 Reply)
Discussion started by: bizomb
1 Replies

9. Shell Programming and Scripting

Remove space from numeric value

Hello, I need help. I have xml file and there are one extra space on number <EpiReference>1 42345</EpiReference>. And of cource, the value change on every new file. I need remove space from that value what is in between <EpiReference> and </EpiReference>. How I can do that? This are example... (9 Replies)
Discussion started by: Jopsulainen
9 Replies

10. UNIX for Beginners Questions & Answers

Remove space with sed

Hello Folks , myfile contains 1000000 records as follows: logver=56 idseq=63256 itime=1111 devid=TG-40 devname=PUI-C2 vd=USER date=2019_01_10 time=18:39:49 logid="000013" type="traffic" subtype="forward" level="notice" eventtime=134 srcip=1.1.1.1 srcport=1 srcintf="XYX-CORE.01"... (3 Replies)
Discussion started by: arm
3 Replies
XML::Catalog(3) 					User Contributed Perl Documentation					   XML::Catalog(3)

NAME
XML::Catalog - Resolve public identifiers and remap system identifiers SYNOPSIS
use XML::Catalog; my $catalog=XML::Catalog->new('/xml/catalog.cat'); $catalog->add('http://www.w3.org/xcatalog/mastercat.xml'); my $sysid=$catalog->resolve_public('-//John Cowan//LOC Diacritics'); my $newsysid=$catalog->remap_system('http://www.w3.org'); $parser->setHandlers(ExternEnt=>$catalog->get_handler($parser)); Oasis Example $ perl -e 'use XML::Catalog; $pubid = q|-//OASIS//DTD DocBook XML V4.5//EN|; my $catalog=XML::Catalog->new("/etc/xml/catalog"); print $catalog->resolve_public($pubid), " ";' file:///usr/share/sgml/docbook/xml-dtd-4.5-1.0-51.el6/docbookx.dtd DESCRIPTION
This module implements draft 0.4 of John Cowan's XML Catalog (formerly known as XCatalog) proposal (<http://www.ccil.org/~cowan/XML/XCatalog.html>). Catalogs may be written in either SOCAT or XML syntax (see the proposal for syntax details); XML::Catalog will assume SOCAT syntax if the catalog is not in well-formed XML syntax. This module, as of 1.0.0, also supports Oasis XML catalogs. CONSTRUCTOR
new(URL [,URL]*) Read the catalog identified by URL and return a catalog object implementing it. If more than one URL is given, chain the additional catalogs as extensions to the catalog (they will be searched before catalogs specified by EXTEND entries). All URLs must be absolute. A URL with no protocol is treated as a filename. METHODS
add(URL [,URL]*) Chain the catalogs identified by the URL(s) to the current catalog. resolve_public(PUBID) Translate the public identifier PUBID to a system identifier. Returns undef if the identifier could not be translated. remap_system(SYSID) Remap the system identifier SYSID as specified by the catalog. Returns SYSID unchanged if no remapping was found. get_handler(PARSER) Returns a coderef to a resolver suitable for use as the ExternEnt handler for an XML::Parser object. The resolver will first attempt to resolve a public identifier if supplied, and then attempt to remap the resulting system identifier (or the original system identifier if no public identifier was supplied). It will then call the original ExternEnt handler associated with the parser object. PARSER is the parser object; it is needed as an argument in order to obtain the original handler. add_delegate($pubid, $href) TBD add_extend($href) TBD add_extend_object($cat, $group ) TBD add_map($pubid, $href) TBD add_remap($sysid, $href) TBD build($url) create new catalog object fix_base($url) TBD parse TBD parse_SOCAT($ct) TBD parse_XML($ct) TBD set_base($href) TBD BUGS
/ TODO Searching of chained catalogs is not purely depth-first (EXTEND items in a chained catalog will be searched before EXTEND items in the original catalog. Error checking leaves much to be desired. AUTHOR
Current Author: Jeff Fearn E<lt>jfearn@cpan.orgE<gt>. Former Authors: Eric Bohlman E<lt>ebohlman@netcom.comE<gt>. COPYRIGHT
Copyright (c) 1999-2000 Eric Bohlman. All rights reserved. Copyright (c) 2013 Jeff Fearn. All rights reserved. This program is free software; you can use/modify/redistribute it under the same terms as Perl itself. perl v5.16.3 2013-10-28 XML::Catalog(3)
All times are GMT -4. The time now is 07:53 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy