Jump to content

A simple question about python


Recommended Posts

Hello,everybody! I want to implement a very simple function by workflow. First, type the keyword as a trigger  and a number (for example decimal 23.45678) as a query. Then,  convert  it to 23.46(keep two decimal places). Finally, copy the consequence to the clipboard. It seems a really easy job.  But I don’t know how the query or arguments input and output through python. After searching answers for several hours, I can’t find similar demos from internet. It makes me a little depressed.

Could anybody do me a favor? Thanks so much!

Link to comment
from __future__ import print_function 
print('{:.2f}'.format(42.022345545456))

Will return

42.02

You could you pyperclip to write to the clipboard or pass the object along to the Alfred clipboard object.

Dean Jackson's Alfred-Workflow library can handle the interface with Alfred if you need more complexity.

Link to comment
On 5/30/2019 at 5:50 AM, amoose136 said:

from __future__ import print_function 
print('{:.2f}'.format(42.022345545456))

Will return


42.02

You could you pyperclip to write to the clipboard or pass the object along to the Alfred clipboard object.

Dean Jackson's Alfred-Workflow library can handle the interface with Alfred if you need more complexity.

Thanks so much !

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...