
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
This is a Python package that reads text from the clipboard and outputs the character count.
Install via pip:
pip install clipcount
If you encounter a "WARNING: The script clipcount.exe is installed in 'path' which is not on PATH.
" when running the above command on Windows, please refer to the following article.
Reference: 【Python Windows】pip install でPATHが通らない時の解決方法 | ゆすノート
If you see "WARNING: Failed to write executable - trying to use .deleteme logic
," please run the terminal with administrator privileges and then proceed with the installation. For more details, refer to the following article:
Reference: Error installing package with executable · Issue #9023 · pypa/pip
Option | Description |
---|---|
clipcount -h | Display the help screen. |
clipcount --help_jp | Display the help screen in Japanese. |
clipcount -b | Output the character count after removing line breaks (\n or \r\n ). |
clipcount -s | Output the character count after removing half-width spaces. |
clipcount -S | Output the character count after removing full-width spaces. |
clipcount -t | Output the character count after removing tab characters (\t ). |
clipcount --split | Output the character count after removing all whitespace characters (line breaks, half-width spaces, full-width spaces, tabs). |
clipcount -m | Calculate characters with half-width alphanumeric characters as 0.5 and output the character count. |
Use it as a command-line tool to output character counts on the terminal:
clipcount [options]
It can also be imported into Python files:
from clipcount import clipcount
x = clipcount({options})
Note: The examples below are executed in a "Windows" environment, so line breaks are counted as "\r\n
".
Copy the following text and run clipcount:
Read
clipboard text.
# Output the character count including whitespace characters
$ clipcount
21
# One half-width space is removed and output
$ clipcount -s
20
# The above spaces are half-width spaces, so nothing changes.
$ clipcount -S
21
# Line breaks are removed and output
$ clipcount -b
19
# Full-width space characters are removed
$ clipcount -sSbt
18
Alternatively, using --split
yields the same result.
# Full-width space characters are removed
$ clipcount --split
18
# Half-width alphanumeric characters are counted as 0.5
$ clipcount -m
10.5
It can also be used in a Python file with "import".
As a note, when passing commands to options, please exclude "-
" or "--
".
# Store the character count of the clipboard in a variable
from clipcount import clipcount
x = clipcount({"split"})
print(x)
# Produces the same result as "clipcount --split"
$ python foo.py
18
clipcount is a Python package that "reads the clipboard and outputs the character count." By default, it outputs the "character count including whitespace characters (line breaks, half-width spaces, full-width spaces, tabs)." It also calculates both half-width and full-width characters as "the same 1 character."
With various options, you can output the character count after removing each whitespace character.
When used in the terminal, options can be combined. For example, to output "the character count after removing only full-width spaces and tabs," you can use "clipcount -St
".
If you want to remove all whitespace characters at once, the "--split
" option can be used. This has the same meaning as "-bsSt
".
If you want to calculate half-width and full-width characters separately, you can use the "-m
" option. This is an option to calculate half-width characters as "0.5 characters." It may be useful when considering character counts in situations like WordPress titles or meta keywords.
FAQs
Reads the clipboard and outputs the character count.
We found that clipcount demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.