how to use String.strip()

本文详细介绍了 Python 中的字符串处理方法 strip() 的使用方法。该方法用于移除字符串两端的指定字符,默认情况下移除空白字符。文章通过示例展示了如何使用 strip() 方法,并解释了其参数的作用。

Description

The method strip() returns a copy of the string in which all chars have been stripped from the beginning and the end of the string (default whitespace characters).

Syntax

Following is the syntax for strip() method

str.strip([chars]);

Parameters

  • chars -- The characters to be removed from beginning or end of the string.

Return Value

This method returns a copy of the string in which all chars have been stripped from the beginning and the end of the string.

Example

The following example shows the usage of strip() method.

#!/usr/bin/python

str = "0000000this is string example....wow!!!0000000";
print str.strip( '0' );

Let us compile and run the above program, this will produce the following result:

this is string example....wow!!!

reference:
http://www.tutorialspoint.com/python/string_strip.htm 
gezi@ubuntu:~/curl-8.7.1$ ./configure --host=arm-linux-gnueabi --prefix=/home/gezi/study/pubilc/camerademo6/curl_arm --with-wolfssl=/home/gezi/wolfssl checking whether to enable maintainer-specific portions of Makefiles... no checking whether make supports nested variables... yes checking whether to enable debug build options... no checking whether to enable compiler optimizer... (assumed) yes checking whether to enable strict compiler warnings... no checking whether to enable compiler warnings as errors... no checking whether to enable curl debug memory tracking... no checking whether to enable hiding of library internal symbols... yes checking whether to enable c-ares for DNS lookups... no checking whether to disable dependency on -lrt... (assumed no) checking whether to enable ECH support... no checking for path separator... : checking for sed... /bin/sed checking for grep... /bin/grep checking that grep -E works... yes checking for arm-linux-gnueabi-ar... /usr/bin/arm-linux-gnueabi-ar checking for a BSD-compatible install... /usr/bin/install -c checking for arm-linux-gnueabi-gcc... arm-linux-gnueabi-gcc checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... yes checking for suffix of object files... o checking whether the compiler supports GNU C... yes checking whether arm-linux-gnueabi-gcc accepts -g... yes checking for arm-linux-gnueabi-gcc option to enable C11 features... none needed checking whether arm-linux-gnueabi-gcc understands -c and -o together... yes checking how to run the C preprocessor... arm-linux-gnueabi-gcc -E checking for stdio.h... yes checking for stdlib.h... yes checking for string.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for strings.h... yes checking for sys/stat.h... yes checking for sys/types.h... yes checking for unistd.h... yes checking for stdatomic.h... yes checking if _Atomic is available... yes checking for a sed that does not truncate output... (cached) /bin/sed checking for code coverage support... no checking whether build environment is sane... yes checking for arm-linux-gnueabi-strip... arm-linux-gnueabi-strip checking for a race-free mkdir -p... /bin/mkdir -p checking for gawk... gawk checking whether make sets $(MAKE)... yes checking whether make supports the include directive... yes (GNU style) checking dependency style of arm-linux-gnueabi-gcc... gcc3 checking curl version... 8.7.1 checking for httpd... no checking for apache2... no checking for apachectl... no checking for apxs... no configure: httpd/apache2 not in PATH, http tests disabled configure: apxs not in PATH, http tests disabled checking for nghttpx... no checking for caddy... no checking build system type... x86_64-pc-linux-gnu checking host system type... arm-unknown-linux-gnueabi checking for grep that handles long lines and -e... (cached) /bin/grep checking for egrep... /bin/grep -E checking if OS is AIX (to define _ALL_SOURCE)... no checking if _THREAD_SAFE is already defined... no checking if _THREAD_SAFE is actually needed... no checking if _THREAD_SAFE is onwards defined... no checking if _REENTRANT is already defined... no checking if _REENTRANT is actually needed... no checking if _REENTRANT is onwards defined... no checking for special C compiler options needed for large files... no checking for _FILE_OFFSET_BITS value needed for large files... 64 checking how to print strings... printf checking for a sed that does not truncate output... (cached) /bin/sed checking for fgrep... /bin/grep -F checking for ld used by arm-linux-gnueabi-gcc... /usr/arm-linux-gnueabi/bin/ld checking if the linker (/usr/arm-linux-gnueabi/bin/ld) is GNU ld... yes checking for BSD- or MS-compatible name lister (nm)... /usr/bin/arm-linux-gnueabi-nm -B checking the name lister (/usr/bin/arm-linux-gnueabi-nm -B) interface... BSD nm checking whether ln -s works... yes checking the maximum length of command line arguments... 1572864 checking how to convert x86_64-pc-linux-gnu file names to arm-unknown-linux-gnueabi format... func_convert_file_noop checking how to convert x86_64-pc-linux-gnu file names to toolchain format... func_convert_file_noop checking for /usr/arm-linux-gnueabi/bin/ld option to reload object files... -r checking for arm-linux-gnueabi-file... no checking for file... file configure: WARNING: using cross tools not prefixed with host triplet checking for arm-linux-gnueabi-objdump... arm-linux-gnueabi-objdump checking how to recognize dependent libraries... pass_all checking for arm-linux-gnueabi-dlltool... no checking for dlltool... no checking how to associate runtime and link libraries... printf %s\n checking for arm-linux-gnueabi-ar... /usr/bin/arm-linux-gnueabi-ar checking for archiver @FILE support... @ checking for arm-linux-gnueabi-strip... (cached) arm-linux-gnueabi-strip checking for arm-linux-gnueabi-ranlib... arm-linux-gnueabi-ranlib checking command to parse /usr/bin/arm-linux-gnueabi-nm -B output from arm-linux-gnueabi-gcc object... ok checking for sysroot... no checking for a working dd... /bin/dd checking how to truncate binary pipes... /bin/dd bs=4096 count=1 checking for arm-linux-gnueabi-mt... no checking for mt... mt checking if mt is a manifest tool... no checking for dlfcn.h... yes checking for objdir... .libs checking if arm-linux-gnueabi-gcc supports -fno-rtti -fno-exceptions... no checking for arm-linux-gnueabi-gcc option to produce PIC... -fPIC -DPIC checking if arm-linux-gnueabi-gcc PIC flag -fPIC -DPIC works... yes checking if arm-linux-gnueabi-gcc static flag -static works... yes checking if arm-linux-gnueabi-gcc supports -c -o file.o... yes checking if arm-linux-gnueabi-gcc supports -c -o file.o... (cached) yes checking whether the arm-linux-gnueabi-gcc linker (/usr/arm-linux-gnueabi/bin/ld) supports shared libraries... yes checking whether -lc should be explicitly linked in... no checking dynamic linker characteristics... GNU/Linux ld.so checking how to hardcode library paths into programs... immediate checking whether stripping libraries is possible... yes checking if libtool supports shared libraries... yes checking whether to build shared libraries... yes checking whether to build static libraries... yes checking whether to build shared libraries with -version-info... yes checking whether to build shared libraries with -no-undefined... no checking whether to build shared libraries with -mimpure-text... no checking whether to build shared libraries with PIC... yes checking whether to build static libraries with PIC... no checking whether to build shared libraries only... no checking whether to build static libraries only... no checking for arm-linux-gnueabi-windres... no checking for windres... no checking for inline... inline checking if cpp -P is needed... yes checking if cpp -P works... yes checking if compiler is DEC/Compaq/HP C... no checking if compiler is HP-UX C... no checking if compiler is IBM C... no checking if compiler is Intel C... no checking if compiler is clang... no checking if compiler is GNU C... yes checking compiler version... gcc '700' (raw: '7') checking if compiler is SGI MIPSpro C... no checking if compiler is SGI MIPS C... no checking if compiler is SunPro C... no checking if compiler is Tiny C... no checking whether build target is a native Windows one... no checking if compiler accepts some basic options... yes configure: compiler options added: -Werror-implicit-function-declaration checking if compiler optimizer assumed setting might be used... yes checking if compiler accepts optimizer enabling options... yes configure: compiler options added: -O2 checking if compiler accepts strict warning options... yes configure: compiler options added: -Wno-system-headers checking if compiler halts on compilation errors... yes checking if compiler halts on negative sized arrays... yes checking if compiler halts on function prototype mismatch... yes checking if compiler supports hiding library internal symbols... yes checking whether build target supports WIN32 file API... no checking whether build target supports WIN32 crypto API... no checking for good-to-use Darwin CFLAGS... no checking whether to link macOS CoreFoundation, CoreServices, and SystemConfiguration frameworks... no checking to see if the compiler supports __builtin_available()... no checking whether to support http... yes checking whether to support ftp... yes checking whether to support file... yes checking whether to support ldap... yes checking whether to support ldaps... yes checking whether to support rtsp... yes checking whether to support proxies... yes checking whether to support dict... yes checking whether to support telnet... yes checking whether to support tftp... yes checking whether to support pop3... yes checking whether to support imap... yes checking whether to support smb... yes checking whether to support smtp... yes checking whether to support gopher... yes checking whether to support mqtt... no checking whether to build documentation... yes checking whether to provide built-in manual... yes checking whether to enable generation of C code... yes checking whether to use libgcc... no checking if X/Open network library is required... no checking for gethostbyname... yes checking whether build target is a native Windows one... (cached) no checking for proto/bsdsocket.h... no checking for connect in libraries... yes checking for sys/types.h... (cached) yes checking for sys/time.h... yes checking for monotonic clock_gettime... yes checking for clock_gettime in libraries... no additional lib required checking for sys/types.h... (cached) yes checking for sys/time.h... (cached) yes checking for raw monotonic clock_gettime... yes checking for arm-linux-gnueabi-pkg-config... no checking for pkg-config... /usr/bin/pkg-config checking for zlib options with pkg-config... found checking for zlib.h... yes configure: found both libz and libz.h header checking for BrotliDecoderDecompress in -lbrotlidec... no checking for brotli/decode.h... no checking for ZSTD_createDStream in -lzstd... no checking for zstd.h... no checking for lber.h... no checking for ldap.h... no checking for ldap_ssl.h... no checking for LDAP libraries... cannot find LDAP libraries configure: WARNING: Cannot find libraries for LDAP support: LDAP disabled checking whether to enable IPv6... yes checking if struct sockaddr_in6 has sin6_scope_id member... yes checking if argv can be written to... no configure: WARNING: the previous check could not be made default was used checking if GSS-API support is requested... no checking whether to enable Windows native SSL/TLS... no checking whether to enable Secure Transport... no checking whether to enable Amiga native SSL/TLS (AmiSSL v5)... no checking for arm-linux-gnueabi-pkg-config... /usr/bin/pkg-config checking for wolfssl options with pkg-config... no configure: Check dir default/lib/pkgconfig configure: Add -L/home/gezi/wolfssl/lib to LDFLAGS configure: Add -I/home/gezi/wolfssl/include to CPPFLAGS configure: Add -lwolfssl to LIBS checking for wolfSSL_Init in -lwolfssl... no configure: error: --with-wolfssl but wolfSSL was not found or doesn't work
10-12
gezi@ubuntu:~/curl-8.7.1$ ./configure \ > --build=x86_64-pc-linux-gnu \ # 使用步骤1获取的值 configure: WARNING: you should use --build, --host, --target configure: WARNING: invalid host type: checking whether to enable maintainer-specific portions of Makefiles... no checking whether make supports nested variables... yes checking whether to enable debug build options... no checking whether to enable compiler optimizer... (assumed) yes checking whether to enable strict compiler warnings... no checking whether to enable compiler warnings as errors... no checking whether to enable curl debug memory tracking... no checking whether to enable hiding of library internal symbols... yes checking whether to enable c-ares for DNS lookups... no checking whether to disable dependency on -lrt... (assumed no) checking whether to enable ECH support... no checking for path separator... : checking for sed... /bin/sed checking for grep... /bin/grep checking that grep -E works... yes checking for -ar... no checking for ar... /usr/bin/ar configure: WARNING: using cross tools not prefixed with host triplet checking for a BSD-compatible install... /usr/bin/install -c checking for -gcc... no checking for gcc... gcc checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... yes checking for suffix of object files... o checking whether the compiler supports GNU C... yes checking whether gcc accepts -g... yes checking for gcc option to enable C11 features... none needed checking whether gcc understands -c and -o together... yes checking how to run the C preprocessor... gcc -E checking for stdio.h... yes checking for stdlib.h... yes checking for string.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for strings.h... yes checking for sys/stat.h... yes checking for sys/types.h... yes checking for unistd.h... yes checking for stdatomic.h... yes checking if _Atomic is available... yes checking for a sed that does not truncate output... (cached) /bin/sed checking for code coverage support... no checking whether build environment is sane... yes checking for -strip... no checking for strip... strip checking for a race-free mkdir -p... /bin/mkdir -p checking for gawk... gawk checking whether make sets $(MAKE)... yes checking whether make supports the include directive... yes (GNU style) checking dependency style of gcc... gcc3 checking curl version... 8.7.1 checking for httpd... no checking for apache2... no checking for apachectl... no checking for apxs... no configure: httpd/apache2 not in PATH, http tests disabled configure: apxs not in PATH, http tests disabled checking for nghttpx... no checking for caddy... no configure: error: select TLS backend(s) or disable TLS with --without-ssl. Select from these: --with-amissl --with-bearssl --with-gnutls --with-mbedtls --with-openssl (also works for BoringSSL and libressl) --with-rustls --with-schannel --with-secure-transport --with-wolfssl
10-11
继续安装之后,再次执行pnpm i 出现新问题node_modules/.pnpm/jpegtran-bin@5.0.2/node_modules/jpegtran-bin: Running postinstall script, failed in 25.3s .../node_modules/jpegtran-bin postinstall$ node lib/install.js │ ⚠ getaddrinfo ENOTFOUND cdn.npmmirror.com │ ⚠ jpegtran pre-build test failed │ ℹ compiling from source │ ✖ Error: Command failed: /bin/sh -c ./configure --disable-shared --prefix="/home/jenkins/pms-web/node_modules/.pnpm/jpegtran-bin@5.0.2/node_modules/jpegtran-bin/vendor" --bindir="/home/jenkins/pms-web/node_modules/.pnpm/jp… │ configure: error: no nasm (Netwide Assembler) found │ checking for a BSD-compatible install... /usr/bin/install -c │ checking whether build environment is sane... yes │ checking for a thread-safe mkdir -p... /usr/bin/mkdir -p │ checking for gawk... gawk │ checking whether make sets $(MAKE)... yes │ checking whether make supports nested variables... yes │ checking whether make supports nested variables... (cached) yes │ checking for style of include used by make... GNU │ checking for gcc... gcc │ checking whether the C compiler works... yes │ checking for C compiler default output file name... a.out │ checking for suffix of executables... │ checking whether we are cross compiling... no │ checking for suffix of object files... o │ checking whether we are using the GNU C compiler... yes │ checking whether gcc accepts -g... yes │ checking for gcc option to accept ISO C89... none needed │ checking whether gcc understands -c and -o together... yes │ checking dependency style of gcc... gcc3 │ checking how to run the C preprocessor... gcc -E │ checking for gcc... (cached) gcc │ checking whether we are using the GNU C compiler... (cached) yes │ checking whether gcc accepts -g... (cached) yes │ checking for gcc option to accept ISO C89... (cached) none needed │ checking whether gcc understands -c and -o together... (cached) yes │ checking dependency style of gcc... (cached) gcc3 │ checking for ar... ar │ checking the archiver (ar) interface... ar │ checking dependency style of gcc... gcc3 │ checking build system type... x86_64-unknown-linux-gnu │ checking host system type... x86_64-unknown-linux-gnu │ checking how to print strings... printf │ checking for a sed that does not truncate output... /usr/bin/sed │ checking for grep that handles long lines and -e... /usr/bin/grep │ checking for egrep... /usr/bin/grep -E │ checking for fgrep... /usr/bin/grep -F │ checking for ld used by gcc... /usr/bin/ld │ checking if the linker (/usr/bin/ld) is GNU ld... yes │ checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B │ checking the name lister (/usr/bin/nm -B) interface... BSD nm │ checking whether ln -s works... yes │ checking the maximum length of command line arguments... 1572864 │ checking how to convert x86_64-unknown-linux-gnu file names to x86_64-unknown-linux-gnu format... func_convert_file_noop │ checking how to convert x86_64-unknown-linux-gnu file names to toolchain format... func_convert_file_noop │ checking for /usr/bin/ld option to reload object files... -r │ checking for objdump... objdump │ checking how to recognize dependent libraries... pass_all │ checking for dlltool... no │ checking how to associate runtime and link libraries... printf %s\n │ checking for archiver @FILE support... @ │ checking for strip... strip │ checking for ranlib... ranlib │ checking command to parse /usr/bin/nm -B output from gcc object... ok │ checking for sysroot... no │ checking for a working dd... /usr/bin/dd │ checking how to truncate binary pipes... /usr/bin/dd bs=4096 count=1 │ checking for mt... no │ checking if : is a manifest tool... no │ checking for ANSI C header files... yes │ checking for sys/types.h... yes │ checking for sys/stat.h... yes │ checking for stdlib.h... yes │ checking for string.h... yes │ checking for memory.h... yes │ checking for strings.h... yes │ checking for inttypes.h... yes │ checking for stdint.h... yes │ checking for unistd.h... yes │ checking for dlfcn.h... yes │ checking for objdir... .libs │ checking if gcc supports -fno-rtti -fno-exceptions... no │ checking for gcc option to produce PIC... -fPIC -DPIC │ checking if gcc PIC flag -fPIC -DPIC works... yes │ checking if gcc static flag -static works... no │ checking if gcc supports -c -o file.o... yes │ checking if gcc supports -c -o file.o... (cached) yes │ checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes │ checking dynamic linker characteristics... GNU/Linux ld.so │ checking how to hardcode library paths into programs... immediate │ checking whether stripping libraries is possible... yes │ checking if libtool supports shared libraries... yes │ checking whether to build shared libraries... no │ checking whether to build static libraries... yes │ checking whether ln -s works... yes │ checking for pkg-config... /usr/bin/pkg-config │ checking pkg-config is at least version 0.9.0... yes │ checking size of size_t... 8 │ checking whether compiler supports pointers to undefined structures... yes │ checking whether __SUNPRO_C is declared... no │ checking for ANSI C header files... (cached) yes │ checking stddef.h usability... yes │ checking stddef.h presence... yes │ checking for stddef.h... yes │ checking for stdlib.h... (cached) yes │ checking locale.h usability... yes │ checking locale.h presence... yes │ checking for locale.h... yes │ checking for string.h... (cached) yes │ checking for sys/types.h... (cached) yes │ checking for an ANSI C-conforming const... yes │ checking whether char is unsigned... no │ checking for inline... inline │ checking for size_t... yes │ checking for unsigned char... yes │ checking for unsigned short... yes │ checking if right shift is signed... yes │ checking for memset... yes │ checking for memcpy... yes │ checking libjpeg API version... 6.2 │ checking whether to include in-memory source/destination managers... yes │ checking libjpeg shared library version... 62.2.0 │ checking whether the linker supports version scripts... yes (GNU style) │ checking whether to use version script when building libjpeg-turbo... yes │ checking for inline... inline __attribute__((always_inline)) │ checking whether to include arithmetic encoding support... yes │ checking whether to include arithmetic decoding support... yes │ checking whether to use 12-bit samples... no │ checking whether to build TurboJPEG C wrapper... yes │ checking whether to build TurboJPEG Java wrapper... no │ checking if we have SIMD optimisations for cpu type... yes (x86_64) │ checking for nasm... no │ checking for nasmw... no │ checking for yasm... no │ at /home/jenkins/pms-web/node_modules/.pnpm/execa@0.7.0/node_modules/execa/index.js:231:11 │ at process.processTicksAndRejections (node:internal/process/task_queues:95:5) │ at async Promise.all (index 0) └─ Failed in 25.3s at /home/jenkins/pms-web/node_modules/.pnpm/jpegtran-bin@5.0.2/node_modules/jpegtran-bin 这个怎么解决
12-10
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值