掩耳倾听

文章 评论 浏览 27

掩耳倾听 2025-02-17 14:32:01

您可以使用 isin

df['found in df2'] = df['A'].isin(df2['A'].values)

print(df)

    A   found in df2
0   a1  True
1   a2  False
2   a3  True

设置

df = pd.DataFrame({'A':['a1','a2','a3']})
df2 = pd.DataFrame({'A':['a1','a3','a4','a7']})

You can use isin:

df['found in df2'] = df['A'].isin(df2['A'].values)

print(df)

    A   found in df2
0   a1  True
1   a2  False
2   a3  True

Setup

df = pd.DataFrame({'A':['a1','a2','a3']})
df2 = pd.DataFrame({'A':['a1','a3','a4','a7']})

熊猫映射两个数据框之间的列

掩耳倾听 2025-02-17 13:35:20

您可以使用 NAN 更改为 0

import pandas as pd
import numpy as np

# for column
df['column'] = df['column'].replace(np.nan, 0)

# for whole dataframe
df = df.replace(np.nan, 0)

# inplace
df.replace(np.nan, 0, inplace=True)

You could use replace to change NaN to 0:

import pandas as pd
import numpy as np

# for column
df['column'] = df['column'].replace(np.nan, 0)

# for whole dataframe
df = df.replace(np.nan, 0)

# inplace
df.replace(np.nan, 0, inplace=True)

如何替换数据帧列中的NAN值

掩耳倾听 2025-02-17 10:39:25

如果您仔细查看OUPUT,您将意识到您在任务级别(您已经使用的键),但也可以在结果上。这是您想在循环中考虑到的东西。

知道这一点,您首先必须摆脱两个条件,因为任务本身的失败状态不会以任务项目的状态为前提。它只是给您一个普遍的指示,表明至少有一个元素失败。

{%{%{%{%}

{% for result in server_port_check.results if result.failed %}
{% for result in server_port_check.results if not result.failed %}

然后,您可以对... 。 x/templates/#jinja-filters.select“ rel =” nofollow noreferrer“> sélect filter 以及 失败 succe> succes> success> succes> Succe> Success 测试

{% for result in server_port_check.results | select("failed") %}
{% for result in server_port_check.results | select("success") %}

使用您的数据,模板:

Port Checks:
{% for result in server_port_check.results | select("failed") %}
  {%- if loop.first -%}
    The following ports are not open:
  {%- endif %}

Host:   {{ result.item.name }}
Port:   {{ result.item.port }}
{% endfor %}

{% for result in server_port_check.results | select("success") %}
  {%- if loop.first -%}
    The following ports are open:
  {%- endif %}

Host:   {{ result.item.name }}
Port:   {{ result.item.port }}
{% endfor %}

将渲染在:

Port Checks:
The following ports are not open:
Host:   salt
Port:   4505
  
The following ports are open:
Host:   dc.com
Port:   636

If you look at your ouput carefully, you will realise that you have a failed key at the task level (the one you are using already), but also at the results. This is something you want to take into account in your loops.

Knowing that, you will first have to get rid of your two conditions, as, the failed status of the task itself does not presuppose the status of the items of the task. It just gives you a general indication that there is at least one elements that failed.

Then, you can either do a {% for ... if ... %}

{% for result in server_port_check.results if result.failed %}
{% for result in server_port_check.results if not result.failed %}

Or a filter with the sélect filter along with the failed and success tests

{% for result in server_port_check.results | select("failed") %}
{% for result in server_port_check.results | select("success") %}

With your data, the following template:

Port Checks:
{% for result in server_port_check.results | select("failed") %}
  {%- if loop.first -%}
    The following ports are not open:
  {%- endif %}

Host:   {{ result.item.name }}
Port:   {{ result.item.port }}
{% endfor %}

{% for result in server_port_check.results | select("success") %}
  {%- if loop.first -%}
    The following ports are open:
  {%- endif %}

Host:   {{ result.item.name }}
Port:   {{ result.item.port }}
{% endfor %}

Will render in:

Port Checks:
The following ports are not open:
Host:   salt
Port:   4505
  
The following ports are open:
Host:   dc.com
Port:   636

在Ansible模板中有条件的循环

掩耳倾听 2025-02-17 05:33:33

不确定是否可以在sentry UI中过滤,但是您肯定会根据 sentryappender 它将仅在达到某些阈值时衡量事件并发射事件。

Not sure if it is possible to filter in Sentry UI, but you an definitely create a custom Sentry appender based on SentryAppender which will measure the occurrence and emit event to Sentry only when it reaches certain threshold.

根据发生率,在运行时更改日志级别的方法是什么

掩耳倾听 2025-02-16 22:54:27

一个选项是用 na 替换0,然后使用 fill

library(dplyr)
library(tidyr)
DF1 %>%
   mutate(New = na_if(New, 0)) %>%
   group_by(Group) %>% 
   fill(New) %>%
   ungroup %>%
   mutate(New = replace_na(New, 0))

-Output

# A tibble: 15 × 3
   Date       Group   New
   <chr>      <int> <int>
 1 2021-04-20  1001     0
 2 2021-04-21  1001     0
 3 2021-04-22  1001     9
 4 2021-04-23  1001     9
 5 2021-04-24  1001     9
 6 2021-04-25  1001    12
 7 2021-04-26  1001    12
 8 2021-04-27  1001    12
 9 2021-04-28  1001    12
10 2021-04-20  1002     0
11 2021-04-22  1002     1
12 2021-04-23  1002     1
13 2021-04-24  1002     1
14 2021-04-25  1002     3
15 2021-04-26  1002     3

如果已订购了这些值,则可以使用 Cummax

DF1 %>%
   group_by(Group) %>% 
   mutate(New = cummax(New)) %>%
   ungroup

-Output

# A tibble: 15 × 3
   Date       Group   New
   <chr>      <int> <int>
 1 2021-04-20  1001     0
 2 2021-04-21  1001     0
 3 2021-04-22  1001     9
 4 2021-04-23  1001     9
 5 2021-04-24  1001     9
 6 2021-04-25  1001    12
 7 2021-04-26  1001    12
 8 2021-04-27  1001    12
 9 2021-04-28  1001    12
10 2021-04-20  1002     0
11 2021-04-22  1002     1
12 2021-04-23  1002     1
13 2021-04-24  1002     1
14 2021-04-25  1002     3
15 2021-04-26  1002     3

数据

DF1 <- structure(list(Date = c("2021-04-20", "2021-04-21", "2021-04-22", 
"2021-04-23", "2021-04-24", "2021-04-25", "2021-04-26", "2021-04-27", 
"2021-04-28", "2021-04-20", "2021-04-22", "2021-04-23", "2021-04-24", 
"2021-04-25", "2021-04-26"), Group = c(1001L, 1001L, 1001L, 1001L, 
1001L, 1001L, 1001L, 1001L, 1001L, 1002L, 1002L, 1002L, 1002L, 
1002L, 1002L), New = c(0L, 0L, 9L, 0L, 0L, 12L, 0L, 0L, 0L, 0L, 
1L, 0L, 0L, 3L, 0L)), class = "data.frame", row.names = c(NA, 
-15L))

An option is to replace the 0 with NA, then use fill

library(dplyr)
library(tidyr)
DF1 %>%
   mutate(New = na_if(New, 0)) %>%
   group_by(Group) %>% 
   fill(New) %>%
   ungroup %>%
   mutate(New = replace_na(New, 0))

-output

# A tibble: 15 × 3
   Date       Group   New
   <chr>      <int> <int>
 1 2021-04-20  1001     0
 2 2021-04-21  1001     0
 3 2021-04-22  1001     9
 4 2021-04-23  1001     9
 5 2021-04-24  1001     9
 6 2021-04-25  1001    12
 7 2021-04-26  1001    12
 8 2021-04-27  1001    12
 9 2021-04-28  1001    12
10 2021-04-20  1002     0
11 2021-04-22  1002     1
12 2021-04-23  1002     1
13 2021-04-24  1002     1
14 2021-04-25  1002     3
15 2021-04-26  1002     3

If the values are already ordered, then can use cummax

DF1 %>%
   group_by(Group) %>% 
   mutate(New = cummax(New)) %>%
   ungroup

-output

# A tibble: 15 × 3
   Date       Group   New
   <chr>      <int> <int>
 1 2021-04-20  1001     0
 2 2021-04-21  1001     0
 3 2021-04-22  1001     9
 4 2021-04-23  1001     9
 5 2021-04-24  1001     9
 6 2021-04-25  1001    12
 7 2021-04-26  1001    12
 8 2021-04-27  1001    12
 9 2021-04-28  1001    12
10 2021-04-20  1002     0
11 2021-04-22  1002     1
12 2021-04-23  1002     1
13 2021-04-24  1002     1
14 2021-04-25  1002     3
15 2021-04-26  1002     3

data

DF1 <- structure(list(Date = c("2021-04-20", "2021-04-21", "2021-04-22", 
"2021-04-23", "2021-04-24", "2021-04-25", "2021-04-26", "2021-04-27", 
"2021-04-28", "2021-04-20", "2021-04-22", "2021-04-23", "2021-04-24", 
"2021-04-25", "2021-04-26"), Group = c(1001L, 1001L, 1001L, 1001L, 
1001L, 1001L, 1001L, 1001L, 1001L, 1002L, 1002L, 1002L, 1002L, 
1002L, 1002L), New = c(0L, 0L, 9L, 0L, 0L, 12L, 0L, 0L, 0L, 0L, 
1L, 0L, 0L, 3L, 0L)), class = "data.frame", row.names = c(NA, 
-15L))

R中的领先数和滞后数字

掩耳倾听 2025-02-16 16:16:00

使用 pattern properties 而不是属性。在下面的示例中,模式匹配正则。*接受任何属性名称,我允许仅使用 string> string string null 的类型>“额外properties”:false 。

  "patternProperties": {
    "^.*$": {
      "anyOf": [
        {"type": "string"},
        {"type": "null"}
      ]
    }
  },
  "additionalProperties": false

...或者,如果您只想在“对象”中允许字符串(例如原始问题中):

{
  "patternProperties": {
    "^.*$": {
      "type": "string",
    }
  },
  "additionalProperties": false
}

Use patternProperties instead of properties. In the example below, the pattern match regex .* accepts any property name and I am allowing types of string or null only by using "additionalProperties": false.

  "patternProperties": {
    "^.*
quot;: {
      "anyOf": [
        {"type": "string"},
        {"type": "null"}
      ]
    }
  },
  "additionalProperties": false

... or if you just want to allow a string in your "object" (like in the original question):

{
  "patternProperties": {
    "^.*
quot;: {
      "type": "string",
    }
  },
  "additionalProperties": false
}

带有未知属性名称的JSON模式

掩耳倾听 2025-02-16 05:38:09

如果您的班级应该具有相同的行为,那么使用多晶型术变得非常简单。该模式称为策略。让我举个例子。

首先,我们需要使用 enum 。如果您没有 enum ,则可以创建一个方法,该方法将根据您的条件返回枚举值:

if (receipt.getType().equals(X) && receipt.getRegion.equals(EMEA)) // other 
     // code is omitted for the brevity

So enum 将看起来像这样:

public enum ReceiptType
{
    Emea, Y, Apac
}

然后我们需要一个抽象类这将描述派生类的行为:

public abstract class ActionReceipt
{
    public abstract string Do();
}

我们的派生类将看起来以下方式:

public class ActionReceiptEmea : ActionReceipt
{
    public override string Do()
    {
        return "I am Emea";
    }
}

public class ActionReceiptY : ActionReceipt
{
    public override string Do()
    {
        return "I am Y";
    }
}

public class ActionReceiptApac : ActionReceipt
{
    public override string Do()
    {
        return "I am Apac";
    }
}

此外,我们需要一个工厂,该工厂将基于枚举创建派生的类。因此,我们可以使用 factory模式 进行稍作修改:

public class ActionReceiptFactory
{
    private Dictionary<ReceiptType, ActionReceipt> _actionReceiptByType =  
        new Dictionary<ReceiptType, ActionReceipt>
    {
        {
            ReceiptType.Apac, new ActionReceiptApac()
        },
        {
            ReceiptType.Emea, new ActionReceiptEmea()
        },
        {
            ReceiptType.Y, new ActionReceiptY()
        }
    };

    public ActionReceipt GetInstanceByReceiptType(ReceiptType receiptType) =>
        _actionReceiptByType[receiptType];
}

然后在行动中看起来会进行多种态度。这样:

void DoSomething(ReceiptType receiptType) 
{
    ActionReceiptFactory actionReceiptFactory = new ActionReceiptFactory();
    ActionReceipt receipt = 
        actionReceiptFactory.GetInstanceByReceiptType(receiptType);
    string someDoing = receipt.Do(); // Output: "I am Emea"
}

更新:

您可以创建一些辅助方法,该方法将返回 enum 基于基于
您的区域逻辑 recepiptType

public class ReceiptTypeHelper
{
    public ReceiptType Get(ActionReceipt actionReceipt) 
    {
        if (actionReceipt.GetType().Equals("Emea"))
            return ReceiptType.Emea;
        else if (actionReceipt.GetType().Equals("Y"))
            return ReceiptType.Y;

        return ReceiptType.Apac;
    }
}

您可以这样称呼:

void DoSomething()
{
    ReceiptTypeHelper receiptTypeHelper = new ReceiptTypeHelper();
    ReceiptType receiptType = receiptTypeHelper
        .Get(new ActionReceiptEmea());

    ActionReceiptFactory actionReceiptFactory = new 
        ActionReceiptFactory();
    ActionReceipt receipt =
        actionReceiptFactory.GetInstanceByReceiptType(receiptType);
    string someDoing = receipt.Do(); // Output: "I am Emea"
}

If your classes should have the same behaviour, then it becomes pretty simple to use polymorpism. The pattern is called as Strategy. Let me show an example.

At first we need to use enum. If you do not have enum, then you can create a method which will return enum value based on your conditions:

if (receipt.getType().equals(X) && receipt.getRegion.equals(EMEA)) // other 
     // code is omitted for the brevity

So enum will look like this:

public enum ReceiptType
{
    Emea, Y, Apac
}

Then we need an abstract class which will describe behaviour for derived classes:

public abstract class ActionReceipt
{
    public abstract string Do();
}

And our derived classes will look this:

public class ActionReceiptEmea : ActionReceipt
{
    public override string Do()
    {
        return "I am Emea";
    }
}

public class ActionReceiptY : ActionReceipt
{
    public override string Do()
    {
        return "I am Y";
    }
}

public class ActionReceiptApac : ActionReceipt
{
    public override string Do()
    {
        return "I am Apac";
    }
}

Moreover, we need a factory which will create derived classes based on enum. So we can use Factory pattern with a slight modification:

public class ActionReceiptFactory
{
    private Dictionary<ReceiptType, ActionReceipt> _actionReceiptByType =  
        new Dictionary<ReceiptType, ActionReceipt>
    {
        {
            ReceiptType.Apac, new ActionReceiptApac()
        },
        {
            ReceiptType.Emea, new ActionReceiptEmea()
        },
        {
            ReceiptType.Y, new ActionReceiptY()
        }
    };

    public ActionReceipt GetInstanceByReceiptType(ReceiptType receiptType) =>
        _actionReceiptByType[receiptType];
}

And then polymorpism in action will look like this:

void DoSomething(ReceiptType receiptType) 
{
    ActionReceiptFactory actionReceiptFactory = new ActionReceiptFactory();
    ActionReceipt receipt = 
        actionReceiptFactory.GetInstanceByReceiptType(receiptType);
    string someDoing = receipt.Do(); // Output: "I am Emea"
}

UPDATE:

You can create some helper method which will return enum value based on
your logic of region and receiptType:

public class ReceiptTypeHelper
{
    public ReceiptType Get(ActionReceipt actionReceipt) 
    {
        if (actionReceipt.GetType().Equals("Emea"))
            return ReceiptType.Emea;
        else if (actionReceipt.GetType().Equals("Y"))
            return ReceiptType.Y;

        return ReceiptType.Apac;
    }
}

and you can call it like this:

void DoSomething()
{
    ReceiptTypeHelper receiptTypeHelper = new ReceiptTypeHelper();
    ReceiptType receiptType = receiptTypeHelper
        .Get(new ActionReceiptEmea());

    ActionReceiptFactory actionReceiptFactory = new 
        ActionReceiptFactory();
    ActionReceipt receipt =
        actionReceiptFactory.GetInstanceByReceiptType(receiptType);
    string someDoing = receipt.Do(); // Output: "I am Emea"
}

在休息服务上多态性

掩耳倾听 2025-02-16 04:51:55

事实证明,您可以访问容器并列出blobs+dirs,但是您无法在没有异常的情况下检查容器是否存在。我从来没有想过要尝试此操作,因为我现有的代码正在使用以确保用户选择了一个合适的容器

Turns out that you can access the container and list blobs+dirs, but you cannot check if the container exists without getting exception. I never thought to just try this since my existing code was using exists to be sure user had selected a proper container

如何使用SAS令牌连接到BLOB容器?

掩耳倾听 2025-02-15 19:35:44

这样 - 尝试和测试

let data=[ 
 { "positive": 2, "negative": 4 }, 
 { "positive": 9, "negative": 18 }, 
 { "positive": 6, "negative": 12 } 
];

let new_d=[]

data.map((e,i,a)=>{Object.keys(e).map((e1,i1,a1)=>{new_d[e1]=[...new_d[e1]||[],e[e1]]})})

console.log(new_d)

This way - tried and tested

let data=[ 
 { "positive": 2, "negative": 4 }, 
 { "positive": 9, "negative": 18 }, 
 { "positive": 6, "negative": 12 } 
];

let new_d=[]

data.map((e,i,a)=>{Object.keys(e).map((e1,i1,a1)=>{new_d[e1]=[...new_d[e1]||[],e[e1]]})})

console.log(new_d)

enter image description here

如何致电JSON API特定键

掩耳倾听 2025-02-15 10:50:22

您应该在 JSX 元素中设置电子邮件属性:

function App() {
  const [count, setCount] = useState(null);
  
  function getFormData(e) {
    e.preventDefault();
    console.log(count);
  }

  return (
    <div className='App'>
      <form onSubmit={getFormData}>
        <select onChange={(e) => setCount(e.target.value)}>
          <option>select option</option>
          <option>1</option>
          <option>2</option>
          <option>3</option>
        </select>
        <button type='submit'>submit</button>
      </form>
      <Ternaryi email='hyy' name={count} />
    </div>
  );
}

export default App;

You should set the email attribute in the JSX element:

function App() {
  const [count, setCount] = useState(null);
  
  function getFormData(e) {
    e.preventDefault();
    console.log(count);
  }

  return (
    <div className='App'>
      <form onSubmit={getFormData}>
        <select onChange={(e) => setCount(e.target.value)}>
          <option>select option</option>
          <option>1</option>
          <option>2</option>
          <option>3</option>
        </select>
        <button type='submit'>submit</button>
      </form>
      <Ternaryi email='hyy' name={count} />
    </div>
  );
}

export default App;

props.mail值未在react.js中打印在屏幕上

掩耳倾听 2025-02-15 07:32:55

使用 tolocalestring()方法将时间格式更改为24小时,例如 date.toleocalestring('en-us',{hour12:false}) TOLOCALESTRING 方法返回一个按照提供的语言环境和选项参数表示日期和时间的字符串。

const date = new Date();

console.log(
  date.toLocaleString('en-US', {
    hour12: false,
  }),
);

Use the toLocaleString() method to change time formatting to 24 hours, e.g. date.toLocaleString('en-US', {hour12: false}). The toLocaleString method returns a string that represents the date and time according to the provided locale and options parameters.

const date = new Date();

console.log(
  date.toLocaleString('en-US', {
    hour12: false,
  }),
);

如何使用JavaScript将时间从英语转换为法语格式

掩耳倾听 2025-02-15 06:18:20
library(data.table)

# set as data table if yours isn't one already
setDT(df)

# dummy data
df <- data.table(driver = c("Driver A", "Driver A", "Driver A", "Driver B", "Driver B", "Driver B")
                 , points = c(1,5,7,3,5,8)
                 ); df

# calculate cumulative sum and date (assumes data sorted in ascending date already)
df[, `:=` (cum_sum = cumsum(points)
           , date = 1:.N
           )
   , driver
   ]

# plot
ggplot(data=df, aes(x=date, y=cum_sum, group=driver)) +
  geom_line(aes(linetype=driver)) +
  geom_point()

请注意,如果我们有很多驱动程序(杂乱的地块),则按照我们目前的操作绘制一条线可能不是最佳的

library(data.table)

# set as data table if yours isn't one already
setDT(df)

# dummy data
df <- data.table(driver = c("Driver A", "Driver A", "Driver A", "Driver B", "Driver B", "Driver B")
                 , points = c(1,5,7,3,5,8)
                 ); df

# calculate cumulative sum and date (assumes data sorted in ascending date already)
df[, `:=` (cum_sum = cumsum(points)
           , date = 1:.N
           )
   , driver
   ]

# plot
ggplot(data=df, aes(x=date, y=cum_sum, group=driver)) +
  geom_line(aes(linetype=driver)) +
  geom_point()

Notice, plotting one line per driver as we are currently doing may not be optimum if we have many drivers (cluttered plot)

在R中绘制分组数据(同一列)

掩耳倾听 2025-02-15 05:58:13
.booking-row {
  background: url('https://i.sstatic.net/rVSVL.png') no-repeat center center fixed; 
  -webkit-background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
  background-size: cover;
}

.booking-row {
  background: url('https://i.sstatic.net/rVSVL.png') no-repeat center center fixed; 
  -webkit-background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
  background-size: cover;
}

如何在所有屏幕分辨率中拟合内容

掩耳倾听 2025-02-14 15:07:00

您需要更新加入条件,以包括日期过滤器并将其从Where子句中删除。为简单起见,我已重命名了表格和列名。 这是sqlfiddle

 SELECT p.id,
   COUNT(DISTINCT(a.id)) AS documentA_total,
   COUNT(DISTINCT(b.id)) AS documentB_total      
FROM project p
LEFT JOIN docA a ON p.id = a.project_id and a.created_at BETWEEN '2022-01-01' AND '2022-03-31'
LEFT JOIN docB b ON p.id = b.project_id and b.created_at BETWEEN '2022-01-01' AND '2022-03-31'
GROUP BY p.id;

我已重命名为“表和列”名称,以实现简单性。您的确切查询将类似于以下查询,

SELECT "project"."id",
       COUNT(DISTINCT(documenta.id)) AS documentA_total
       COUNT(DISTINCT(documentb.id)) AS documentB_total,       
FROM project
LEFT JOIN documenta ON documenta.projectid = project.id and "documenta"."createdAt" BETWEEN '{{daterange.start}}' AND '{{daterange.end}}'
LEFT JOIN documentb ON documentb.projectid = project.id and "documentb"."createdAt" BETWEEN '{{daterange.start}}' AND '{{daterange.end}}'
GROUP BY project.id;

You need to update your join condition to include the date filter and remove them from where clause. I have renamed the table and column names for simplicity. Here is sqlfiddle

 SELECT p.id,
   COUNT(DISTINCT(a.id)) AS documentA_total,
   COUNT(DISTINCT(b.id)) AS documentB_total      
FROM project p
LEFT JOIN docA a ON p.id = a.project_id and a.created_at BETWEEN '2022-01-01' AND '2022-03-31'
LEFT JOIN docB b ON p.id = b.project_id and b.created_at BETWEEN '2022-01-01' AND '2022-03-31'
GROUP BY p.id;

I have renamed the table and column names for simplicity. Your exact query will be similar to below query,

SELECT "project"."id",
       COUNT(DISTINCT(documenta.id)) AS documentA_total
       COUNT(DISTINCT(documentb.id)) AS documentB_total,       
FROM project
LEFT JOIN documenta ON documenta.projectid = project.id and "documenta"."createdAt" BETWEEN '{{daterange.start}}' AND '{{daterange.end}}'
LEFT JOIN documentb ON documentb.projectid = project.id and "documentb"."createdAt" BETWEEN '{{daterange.start}}' AND '{{daterange.end}}'
GROUP BY project.id;

试图在给定时间范围内计算项目的不同文档类型

掩耳倾听 2025-02-14 14:30:58

可以使用Extension 代码跑步者通过快捷键在右上角的play图标运行代码: ctrl ++ alt ++ n 并流产 ctrl + alt + m 。但是默认情况下,它仅显示程序的输出,但要接收输入,您需要遵循一些步骤:

ctrl + ,然后打开设置菜单,扩展名&gt; run代码配置滚动向下滚动其属性和属性和在设置中查找编辑单击它,然后添加以下代码INSITE:

{
 "code-runner.runInTerminal": true
}

Can use Extension Code Runner to run code with play icon on top Right ans by shortcut key :Ctrl+Alt+N and to abort Ctrl+Alt+M. But by default it only shows output of program but for receiving input you need to follow some steps:

Ctrl+, and then settings menu opens and Extensions>Run Code Configuration scroll down its attributes and find Edit in settings.json click on it and add following code insite it :

{
 "code-runner.runInTerminal": true
}

如何设置Visual Studio代码以编译C&#x2B;&#x2B;代码?

更多

推荐作者

櫻之舞

文章 0 评论 0

弥枳

文章 0 评论 0

m2429

文章 0 评论 0

野却迷人

文章 0 评论 0

我怀念的。

文章 0 评论 0

更多

友情链接

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文